import React, { lazy } from 'react'
import { useRoutes, BrowserRouter } from 'react-router-dom'

const Home = lazy(() => import('../views/home'))
const Car = lazy(() => import('../views/car'))
const Order = lazy(() => import('../views/order'))
const MainLayout = lazy(() => import('../views/mainLayout'))

const routes = [{
	path: '/',
	element: <MainLayout></MainLayout>,
	children: [{
		path: '/',
		element: <Home></Home>
	},{
		path: '/car',
		element: <Car></Car>
	}]
}, {
	path: '/order',
	element: <Order></Order>
}]

const Router = () => {
	const App = () => useRoutes(routes);

	return (
		<BrowserRouter>
			<App></App>
		</BrowserRouter>
	)
}

export default Router